def write_file(filename, content):
    try:
        with open(filename, 'w', encoding='utf-8') as f:
            f.write(content)
        print(f"内容已成功写入到 {filename}")
    except Exception as e:
        print(f"写入文件时出错: {e}")

def read_file(filename):
    try:
        with open(filename, 'r', encoding='utf-8') as f:
            content = f.read()
        return content
    except Exception as e:
        print(f"读入文件时出错: {e}")

if __name__ == "__main__":
    file_name = "text.txt"
    # concent = "测试测试测试测试测试测试测试测试"
    # write_file(file_name, concent)
    content = read_file(file_name)
    print(content)